#!/bin/sh

. ~/.bashrc

cd /home/hadoop/mylib

date=`date -d "+0 day $1" +%y-%m-%d`
enddate=`date -d "+1 day $2" +%y-%m-%d`

echo "------------------------------"
echo "date=$date"
echo "enddate=$enddate"
echo "------------------------------"

while [[ $date < $enddate  ]]
do
        echo $date
	pvShell='/usr/local/hadoop/bin/hadoop jar ~/mylib/kpistats-1.0.0-jar-with-dependencies.jar com.think.PvAutoStatistics -d '$date;
	echo $pvShell;
	eval $pvShell;
	ipShell='/usr/local/hadoop/bin/hadoop jar ~/mylib/kpistats-1.0.0-jar-with-dependencies.jar com.think.UipAutoStatistics -d '$date;
	echo $ipShell;
	eval $ipShell;

	/usr/local/hadoop/bin/hadoop jar ~/mylib/kpistats-1.0.0-jar-with-dependencies.jar com.think.KpiStatistics -d $date
	date=`date -d "+1 day $date" +%y-%m-%d`
done
